-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace Report_AddComment with AddComment (Part 2) #9350
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful. Just nabs and clarifying questions
This is still on HOLD, but I think ready for some reviews. |
Putting a HOLD on this one while we work out some things in https://github.com/Expensify/Web-Expensify/pull/34086 |
This is still on hold pending the deploy of https://github.com/Expensify/Web-Expensify/pull/34086 However, we will need to merge this relatively quickly one that code hits production so I think we should start getting some reviews in. |
Taking this off hold as the linked Web-Expensify PR is on staging. |
We should only merge this when it's on production though. |
Testing well for me on all platforms. |
Just a reminder, this very urgently needs to be merged and deployed as soon as the Web-Expensify PR goes to prod. For that reason I am also CP-ing to staging. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks solid 👍🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Merging it already since it has to go fast
…Action2 Replace Report_AddComment with AddComment (Part 2) (cherry picked from commit 258c268)
…9350 🍒 Cherry pick PR #9350 to staging 🍒
function canUpdateTimezone() { | ||
return lastUpdatedTimezoneTime.isBefore(moment().subtract(5, 'minutes')); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is just a refactor but why do we try to update every 5 minutes? feels like way too often, it probably only matters when a user is traveling but even then I don't really need my timezone updated every step of the way, just like when I arrive to my destination.
actually thinking about this more (i know this is all one comment but time passed between the first paragraph and this one)... why put a time limit on it at all? why not just check if the current timezone is different than the one in onyx and only attempt to set it if they are different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That could work. I'm not sure why we chose every 5 minutes or whether it would be easier to check if the timezone has changed. I think there is some kind of cost associated with trying to "guess" the timezone and maybe that's why this is throttled, but not really focused on improving this particular feature.
DateUtils.setTimezoneUpdated(); | ||
} | ||
|
||
API.write(isAttachment ? 'AddAttachment' : 'AddComment', parameters, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here I might have preferred a separate variable like
const command = isAttachment ? 'AddAttachment' : 'AddComment';
API.write(command, parameters, ...);
or maybe even getting rid of isAttachment
and renaming that command
at the top of the method and instead forking logic if command is AddAttachment
or AddComment
though that might end up being way too verbose 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eh i guess looking back we use isAttachment
inside of the onxyData and a few other places so maybe this is the best route the way it's written.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't really have strong feelings one way or the other on this.
@@ -69,7 +69,7 @@ describe('actions/Report', () => { | |||
// the comment we left and it will be in a loading state because | |||
// it's an "optimistic comment" | |||
expect(action.message[0].text).toBe('Hello!'); | |||
expect(action.loading).toBe(true); | |||
expect(action.isPending).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be isLoading
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes good catch.
@marcaaron We never get notification in mweb.
So step 4, No notification received in mWeb environment. |
Correct me if I'm wrong @marcaaron, but I believe that's expected and maybe depends on the device/browser. I'm an iOS user and never get notifications from mobile websites like I do on my laptop. |
Yeah, I have never seen a mobile web browser notification ever. |
Yeah @kavimuru that isn't a blocker 👍 |
🚀 Deployed to production by @roryabraham in version: 1.1.79-17 🚀
|
Details
This PR:
reportComment
Pusher subscriptions (updateReportWithNewAction()
remains and is used in the Urban Airship notification as I'm not sure how we are handling "onyx updates" there yet)DeprecatedAPI.Report_AddComment()
toAPI.write('AddComment')
To minimize changes I decided to keep the "attachment" and "comment" flows together for now.
Test in connection with: https://github.com/Expensify/Web-Expensify/pull/33951
Fixed Issues (Related to
https://github.com/Expensify/Expensify/issues/211241
Tests
Same as QA but with an additional test to verify that users blocked by Concierge will see an error message inline.
Test Blocked from Concierge
QA Steps
Testing a report comment is sent in realtime
Testing a report comment browser notification appears when the chat is not active (web)
Testing a report comment is queued while offline and sent when online again
Add an attachment
Add an attachment (offline)
Add attachment with text
PR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followed/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Screenshots
Web
Mobile Web
Desktop
iOS
Android